Table of Contents Previous Section

Handling Requests and Responses

A WebScript application is organized around two recurring events: requests and responses. WebScript provides special methods for intervening at the request and response stages---for example, to provide your own validation or post-processing. The methods for doing this are:

The following code excerpt initializes a list of items that will be used to create hyperlinks in a dynamically generated HTML page:

- willPrepareForRequest:aRequest inContext:aContext {
    hotSpots = @("Home Page", "New Products", "Catalog");
    return self;
}

While you typically use awake to initialize variables whose values remain static for the life of the page, these methods are useful for operating at a finer level of granularity---for example, to change a variable's value or to check form data before returning a response.

Table of Contents Next Section